package com.ruoyi.web.controller.ai;

import java.util.List;


import com.ruoyi.ai.domain.AiUserFollow;
import com.ruoyi.ai.service.IAiUserFollowService;
import com.ruoyi.common.core.domain.entity.SysUser;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;

import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 关注管理Controller
 * 
 * @author tang
 * @date 2024-12-10
 */
@RestController
@RequestMapping("/ai/follow")
public class AiUserFollowController extends BaseController
{
    @Autowired
    private IAiUserFollowService aiUserFollowService;

    @PreAuthorize("@ss.hasPermi('ai:follow:list')")
    @GetMapping("/listByFollowerId/{userId}")
    public TableDataInfo listByFollowerId(@PathVariable Long userId)
    {
        startPage();
        List<SysUser> list = aiUserFollowService.selectUserListByFollowerId(userId);
        return getDataTable(list);
    }
    @PreAuthorize("@ss.hasPermi('ai:follow:list')")
    @GetMapping("/listByFolloweeId/{userId}")
    public TableDataInfo listByFolloweeId(@PathVariable Long userId)
    {
        startPage();
        List<SysUser> list = aiUserFollowService.selectUserListByFolloweeId(userId);
        return getDataTable(list);
    }
    @PreAuthorize("@ss.hasPermi('ai:follow:add')")
    @Log(title = "用户关注管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@Validated @RequestBody AiUserFollow aiUserFollow)
    {
        return toAjax(aiUserFollowService.insertAiUserFollow(aiUserFollow));
    }
    @PreAuthorize("@ss.hasPermi('ai:follow:remove')")
    @Log(title = "用户关注管理", businessType = BusinessType.DELETE)
    @DeleteMapping
    public AjaxResult remove(@Validated @RequestBody AiUserFollow aiUserFollow)
    {
        return toAjax(aiUserFollowService.deleteAiUserFollow(aiUserFollow));
    }
}
